/**
 * Demonstrates a range of Button options the framework offers out of the box
 */
Ext.define('cloud.view.coupon.Coupon', {
    extend: 'Ext.navigation.View',
    xtype: 'coupon',
    requires: ['Ext.List', 'Ext.TitleBar', 'Ext.field.Select', 'Ext.field.Search'],
    config: {
        navigationBar:{
          ui:'dark'
        },
        defaultBackButtonText:'返回',
        items: [
            {
                xtype: 'container',
                layout: 'hbox',
                title: '优惠券规则',
                items: [
                    {
                        xtype: 'list',
                        id: 'select_coupon',
                        flex: 1,
                        store: 'Coupon',
                        pressedCls:false,
                        selectedCls:false,
                        cls:'x-list2',
                        onItemDisclosure: true,
                        emptyText: '还未添加优惠券规则',
                        itemTpl:
                            '<input type="button" value="删除" name="toupon_detele" style="width: 100px; position: absolute; top: 30px; right: 60px;font-size: 12px;"  />' +
                            '<div class="listConten">' +
                                '<span>类型：{type}</span>' +
                                '<span>事件： {event}</span>' +
                                '<span>过期时间： {time}</span>' +
                            '</div>'+
                            '<div class="listConten">' +
                                '<span style="margin-right: 150px;">规则：{rule}</span>' +
                                '</div>',
                        listeners:{
                            initialize: function(){
                                Ext.getStore('Coupon').load({params:{cadid:localStorage.getItem('cadid')}});
                            }
                        }
                    },
                    {
                        xtype: 'toolbar',
                        id: 'toolbar_bottom',
                        docked: 'bottom',
                        layout: {
                            type: 'hbox',
                            pack: 'center'
                        },
                        items: [
                            {
                                xtype: 'button',
                                id: 'coupon_add',
                                cls:'x-button2',
                                iconMask: true,
                                text:'添加'
                            }
                        ]
                    }
                ]
            }
        ]
    }
});